/*************
Ten tac gia : LY THIEN KIM
Ngay tao : 8/16/2011
Noi dung : update 1 CRIME_DETAIL

*************/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE NAME = 'sp_UpdateCRIME_DETAIL')
BEGIN
	DROP PROC sp_UpdateCRIME_DETAIL
END
GO
CREATE PROC sp_UpdateCRIME_DETAIL
	@ID				int,
	@IDCRIMINAL		int,
	@IDCOMPLAINT	int,
	@STATUS			int,
	@STATUS_CRIME	int,
	@DATE_TEMP		datetime,
	@DATE_END		datetime,
	@Last_updated	datetime,
	@Result			int out
	AS
	BEGIN	
		IF EXISTS (SELECT * FROM CRIME_DETAIL WHERE ID = @ID and IDCRIMINAL = @IDCRIMINAL and IDCOMPLAINT = @IDCOMPLAINT)
		BEGIN
			UPDATE CRIME_DETAIL SET  STATUS = @STATUS,STATUS_CRIME = @STATUS_CRIME,DATE_TEMP = @DATE_TEMP,DATE_END = @DATE_END,Last_updated = @Last_updated
			WHERE ID = @ID and IDCRIMINAL = @IDCRIMINAL and IDCOMPLAINT = @IDCOMPLAINT
			SET @Result = 1	
		END
		else
		BEGIN
			SET @Result = 0
		END
	END